package P1.gaojingdu;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @date:2022/10/23
 * @author:LdLtd
 * @name:idealist
 */
public class Subtract {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        List<Integer> A = new ArrayList<>();
        List<Integer> B = new ArrayList<>();
        for (int i = a.length() - 1; i >= 0; i--) A.add(a.charAt(i) - '0');
        for (int i = b.length() - 1; i >= 0; i--) B.add(b.charAt(i) - '0');

        if (cmp(A, B)) {
            List<Integer> C = sub(A, B);
            for (int i = C.size() - 1; i >= 0; i--) System.out.print(C.get(i));
        } else {
            List<Integer> C = sub(B, A);
            System.out.print("-");
            for (int i = C.size() - 1; i >= 0; i--) System.out.print(C.get(i));
        }


    }

    public static List<Integer> sub(List<Integer> A, List<Integer> B) {
        List<Integer> C = new ArrayList<>();
        for (int i = 0, t = 0; i < A.size(); i++) {
            //应该为 t = A.get(i) - B.get(i)- t，但需要判断B是否存在该位
            t = A.get(i) - t;
            if (i < B.size()) t -= B.get(i);
            //若存在不够减的情况，t为负数，则存储时应借十取余
            C.add((t + 10) % 10);
            //如果t < 0，说明不够减，则应让表示借位的t为1
            if (t < 0) t = 1;
            else t = 0;
        }
        //注意可能存在高位相同，相减后导致存在高位为0的情况
        while (C.size() > 1 && C.get(C.size() - 1) == 0) C.remove(C.size() - 1);
        return C;
    }

    //判断A>=B
    public static boolean cmp(List<Integer> A, List<Integer> B) {
        if (A.size() != B.size()) return A.size() > B.size();
        else {
            for (int i = A.size() - 1; i >= 0; i--) {
                //如果位数相同，从高位开始循环，直到两者不同，返回两者比较的结果
                if (!A.get(i).equals(B.get(i)))
                    return A.get(i) > B.get(i);
            }
        }
        return true;
    }
}
